from selenium import webdriver
import time

driver = webdriver.Firefox()
driver.get("https://www.baidu.com")
time.sleep(2)
# ⑤ 获取元素内容
data = driver.find_element_by_id("bottom_layer").text
print(data)
# ② 键盘输入
driver.find_element_by_id("kw").send_keys("中国")
time.sleep(2)
# ① 鼠标点击
driver.find_element_by_id("su").click()
# ③ 提交表单
# driver.find_element_by_id("su").submit() --- 这里的输入框也是 submit的, 也可以调用submit()方法
time.sleep(2)
# ④ 清除内容
driver.find_element_by_id("kw").clear()
time.sleep(2)
driver.quit()